/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.mphokazi.designpatterns.test.part2.behavioral;

import org.junit.*;
import za.ac.cput.mphokazi.designpatterns.part1.behavioral.chainofresponsibility.EarthHandler;
import za.ac.cput.mphokazi.designpatterns.part1.behavioral.chainofresponsibility.MercuryHandler;
import za.ac.cput.mphokazi.designpatterns.part1.behavioral.chainofresponsibility.PlanetEnum;
import za.ac.cput.mphokazi.designpatterns.part1.behavioral.chainofresponsibility.PlanetHandler;
import za.ac.cput.mphokazi.designpatterns.part1.behavioral.chainofresponsibility.VenusHandler;

/**
 *
 * @author mphokazi
 */
public class testChainOfResponsibility {
    
    public testChainOfResponsibility() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
     @Test
     public void tetsChainOfresponsibilty() {
         
         PlanetHandler chain = setUpChain();
         chain.handleRequest(PlanetEnum.MERCURY);
         chain.handleRequest(PlanetEnum.EARTH);
         chain.handleRequest(PlanetEnum.VENUS);
         chain.handleRequest(PlanetEnum.JUPITER);
         
     }

    private PlanetHandler setUpChain() {
        PlanetHandler mercuryHandler = new MercuryHandler();
        PlanetHandler venusHandler = new VenusHandler();
        PlanetHandler earthHandler = new EarthHandler();
        
        mercuryHandler.setSuccessor(venusHandler);
        venusHandler.setSuccessor(earthHandler);
        
        return mercuryHandler;
    }
}
